package com.xing.binbackend.pattern.responsibility.ecommerce.pay;

public class OrderService {
    public void createOrder(OrderRequest order) {
        OrderHandler handlerChain =
                new InventoryCheckHandler().linkWith(new RiskControlHandler()).linkWith(new PaymentHandler());

        try {
            handlerChain.handle(order);
            System.out.println("订单创建成功");
        } catch (IllegalStateException e) {
            System.out.println("订单创建失败: " + e.getMessage());
        }
    }
}
